<!DOCTYPE html>
<html lang='en'>

<head>
    <meta charset='UTF-8'>
    <meta name='viewport' content='width=device-width, initial-scale=1.0'>
    <title>Document</title>
    <script type='text/javascript' src='js/vue.js'></script>
</head>

<body>
    <div id='app'>
        {{msg}}
        ======
        <com1></com1>
        ======
        <com2></com2>
        ======
        <com3></com3>
    </div>
    <script type='text/javascript'>
        var obj = {
            template: `
                <div>我是一个全局组件</div>
            `
        }
        var com3 = {
            template: `
                <h1>我是一个私有组件</h1>
            `
        }
        Vue.component('com1', obj)

        var vm = new Vue({
            el: '#app',
            data: {
                msg: 'Hello Vue'
            },
            components: {
                com2: {
                    template: `<div>我是私有组件com2</div>`
                },
                com3: com3,

            }
        });
    </script>
</body>

</html>